<html>
<head><meta charset="utf-8"><title>Handle is Object Safe test · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html">Handle is Object Safe test</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="219637977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Handle%20is%20Object%20Safe%20test/near/219637977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kev <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html#219637977">(Dec 11 2020 at 17:49)</a>:</h4>
<p>Hi, </p>
<p>I was wondering what the utility of this test is: <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/vfs/src/loader.rs#L129">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/vfs/src/loader.rs#L129</a> ?</p>



<a name="219638166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Handle%20is%20Object%20Safe%20test/near/219638166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html#219638166">(Dec 11 2020 at 17:50)</a>:</h4>
<p>That solely tests that the trait <code>Handle</code> is object safe. If It wasn't the use of <code>&amp;dyn Handle</code> as a type would error on compile time</p>



<a name="219638193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Handle%20is%20Object%20Safe%20test/near/219638193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html#219638193">(Dec 11 2020 at 17:50)</a>:</h4>
<p>So it is kind of a compile time test.</p>



<a name="219638274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Handle%20is%20Object%20Safe%20test/near/219638274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html#219638274">(Dec 11 2020 at 17:51)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/reference/items/traits.html?highlight=object,safe#object-safety">https://doc.rust-lang.org/nightly/reference/items/traits.html?highlight=object,safe#object-safety</a></p>



<a name="219638490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Handle%20is%20Object%20Safe%20test/near/219638490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kev <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html#219638490">(Dec 11 2020 at 17:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="300586">Lukas Wirth</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Handle.20is.20Object.20Safe.20test/near/219638166">said</a>:</p>
<blockquote>
<p>That solely tests that the trait <code>Handle</code> is object safe. If It wasn't the use of <code>&amp;dyn Handle</code> as a type would error on compile time</p>
</blockquote>
<p>Would anything silently break if it was not object safe?</p>



<a name="219638582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Handle%20is%20Object%20Safe%20test/near/219638582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html#219638582">(Dec 11 2020 at 17:53)</a>:</h4>
<p>Yeah, but the test signals intent</p>



<a name="219638897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Handle%20is%20Object%20Safe%20test/near/219638897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kev <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Handle.20is.20Object.20Safe.20test.html#219638897">(Dec 11 2020 at 17:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Handle.20is.20Object.20Safe.20test/near/219638582">said</a>:</p>
<blockquote>
<p>Yeah, but the test signals intent</p>
</blockquote>
<p>Ah got it</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>